package jsyf.oa.service.system;

import com.alibaba.dubbo.common.utils.StringUtils;
import jsyf.com.constant.Const;
import jsyf.com.util.BaseUtils;
import jsyf.oa.dao.system.User2GroupDao;
import jsyf.oa.facade.system.User2GroupFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by Administrator on 2018/1/1 0001.
 */
@Service
@Transactional(rollbackFor = Exception.class)
@com.alibaba.dubbo.config.annotation.Service(protocol = {"dubbo"})
public class User2GroupService implements User2GroupFacade {
    @Autowired
    private User2GroupDao dao;

    @Override
    public Boolean config(String userIds, String groupId) {
        if (!StringUtils.isEmpty(userIds) && !StringUtils.isEmpty(groupId)) {
            dao.insertBatch(userIds, groupId);
        }
        return true;
    }

    @Override
    public String removeByUserIdAndGroupId(String userId, String groupId) {
        int flag = dao.removeByCondition(" AND USER_ID=? AND GROUP_ID=?",new String[]{userId,groupId});
        if (Const.INT_ONE == flag) {

        }
        return BaseUtils.succsessObjRespond("删除成功");
    }

}
